//
//  HLMineCellModel.m
//  YueYue
//
//  Created by hulu001 on 2023/5/19.
//

#import "HLMineCellModel.h"

@implementation HLMineCellModel

- (instancetype)initWithTitle:(NSString *)title icon:(NSString *)icon spot:(HLMineCellSpot)spot
{
    if (self = [super init]) {
        self.title = title;
        self.icon = icon;
        self.cellSpot = spot;
        self.hasDetail = YES;
        self.hasSwitch = NO;
        self.detail = @"";
    }
    return self;
}

+ (NSArray<HLMineCellModel*> *)cellWithMine
{
    HLMineCellModel *mission = [[HLMineCellModel alloc] initWithTitle:@"任务中心" icon:@"mine_mission_icon" spot:HLMineCellSpotMissionCenter];
    HLMineCellModel *video = [[HLMineCellModel alloc] initWithTitle:@"发布视频" icon:@"mine_invitation_icon" spot:HLMineCellSpotVideo];
    HLMineCellModel *setting = [[HLMineCellModel alloc] initWithTitle:@"设置" icon:@"mine_setting_icon" spot:HLMineCellSpotSetting];
    if (![HLRunTime shareInstance].isFood){
        return @[mission, setting];
    } else {
        return @[video, setting];
    }
    
}

+ (NSArray<NSArray<HLMineCellModel*> *> *)cellWithSettings
{
    HLMineCellModel *account = [[HLMineCellModel alloc] initWithTitle:@"账号与安全" icon:@"" spot:HLMineCellSpotSettingAccount];
    HLMineCellModel *invitation = [[HLMineCellModel alloc] initWithTitle:@"我的邀请人" icon:@"" spot:HLMineCellSpotSettingInvitation];
    HLMineCellModel *privacy = [[HLMineCellModel alloc] initWithTitle:@"黑名单" icon:@"" spot:HLMineCellSpotSettingPrivacyBlack];
    HLMineCellModel *feedback = [[HLMineCellModel alloc] initWithTitle:@"意见与反馈" icon:@"" spot:HLMineCellSpotSettingFeedback];
    HLMineCellModel *about = [[HLMineCellModel alloc] initWithTitle:@"关于我们" icon:@"" spot:HLMineCellSpotSettingAbout];
    
    HLMineCellModel *update = [[HLMineCellModel alloc] initWithTitle:@"检查更新" icon:@"" spot:HLMineCellSpotSettingUpdate];
    HLMineCellModel *custumer = [[HLMineCellModel alloc] initWithTitle:@"联系客服" icon:@"" spot:HLMineCellSpotSettingCustomer];
    
    HLMineCellModel *logout = [[HLMineCellModel alloc] initWithTitle:@"退出登录" icon:@"" spot:HLMineCellSpotSettingLogout];
    
    NSArray *contacts = @[custumer, feedback, about, update];

    if ([HLRunTime shareInstance].isFood) {
        contacts = @[custumer, feedback, update];
    }
    
    return @[@[account], @[invitation, privacy], contacts, @[logout]];
}

+ (NSArray<HLMineCellModel*> *)cellWithAbout
{
    HLMineCellModel *service = [[HLMineCellModel alloc] initWithTitle:@"《用户服务协议》" icon:@"" spot:HLMineCellSpotSettingAboutService];
    HLMineCellModel *privacy = [[HLMineCellModel alloc] initWithTitle:@"《隐私协议》" icon:@"" spot:HLMineCellSpotSettingAboutPrivacy];

    return @[service, privacy];
}

+ (NSArray<HLMineCellModel *> *)cellWithCustomer
{
    HLMineCellModel *message = [[HLMineCellModel alloc] initWithTitle:@"消息价格" icon:@"" spot:HLMineCellSpotCustomerMessage];
    HLMineCellModel *voice = [[HLMineCellModel alloc] initWithTitle:@"语音价格" icon:@"" spot:HLMineCellSpotCustomerVoice];
    HLMineCellModel *video = [[HLMineCellModel alloc] initWithTitle:@"视频价格" icon:@"" spot:HLMineCellSpotCustomerVideo];
    return @[message, voice, video];
}

+ (NSArray<NSArray<HLMineCellModel*> *> *)cellWithSettingAccount
{
    HLUserInfoModel *user = [HLRunTime shareInstance].mine;
    HLMineCellModel *accountID = [[HLMineCellModel alloc] initWithTitle:@"我的ID" icon:@"" spot:HLMineCellSpotSettingAccountID];
    accountID.detail = user.userYueId;
    
    HLMineCellModel *phone = [[HLMineCellModel alloc] initWithTitle:@"手机号" icon:@"" spot:HLMineCellSpotNon];
    phone.detail = user.mobileNo;
    phone.hasDetail = NO;
    
    
    HLMineCellModel *logout = [[HLMineCellModel alloc] initWithTitle:@"注销账户" icon:@"" spot:HLMineCellSpotSettingAccountLogout];
    if (user.mobileNo.length > 2){
        return @[@[accountID], @[phone], @[logout]];
    } else {
        return @[@[accountID], @[logout]];
    }
}

+ (NSArray<NSArray<HLMineCellModel*> *> *)cellWithSessionSettingWithUser:(HLUserInfoModel *)user session:(NIMSession *)session
{
    HLMineCellModel *info = [[HLMineCellModel alloc] initWithTitle:user.nickName icon:@"" spot:HLMineCellSpotSessionInfo];
    info.detail = user.userYueId;
    
    NIMStickTopSessionInfo *hasTopInfo = [NIMSDK.sharedSDK.chatExtendManager stickTopInfoForSession:session];
    
    HLMineCellModel *top = [[HLMineCellModel alloc] initWithTitle: hasTopInfo ? @"取消置顶聊天": @"置顶聊天" icon:@"" spot:HLMineCellSpotSessionTop];
    
    HLMineCellModel *delete = [[HLMineCellModel alloc] initWithTitle:@"删除聊天记录" icon:@"" spot:HLMineCellSpotSessionDelete];
    
    
    HLMineCellModel *black = [[HLMineCellModel alloc] initWithTitle: [user.isBlacklist boolValue] ? @"取消拉黑" : @"拉黑" icon:@"" spot:HLMineCellSpotSessionBlack];
    
    HLMineCellModel *follow = [[HLMineCellModel alloc] initWithTitle: [user.followType boolValue] ? @"取消关注" : @"关注" icon:@"" spot:HLMineCellSpotSessionFollow];
    
    HLMineCellModel *report = [[HLMineCellModel alloc] initWithTitle:@"举报" icon:@"" spot:HLMineCellSpotSessionReport];
    
    return @[@[info], @[black, follow, report], @[top, delete]];
}


+ (NSArray<NSArray<HLMineCellModel*> *> *)cellWithSettingPrivacy
{
    HLMineCellModel *black = [[HLMineCellModel alloc] initWithTitle:@"黑名单" icon:@"" spot:HLMineCellSpotSettingPrivacyBlack];
    
    HLMineCellModel *album = [[HLMineCellModel alloc] initWithTitle:@"相册权限" icon:@"" spot:HLMineCellSpotSettingPrivacyPhoto];
    album.hasDetail = NO;
    album.hasSwitch = YES;
    
    HLMineCellModel *camera = [[HLMineCellModel alloc] initWithTitle:@"相机权限" icon:@"" spot:HLMineCellSpotSettingPrivacyCamera];
    camera.hasDetail = NO;
    camera.hasSwitch = YES;
    
    HLMineCellModel *microphone = [[HLMineCellModel alloc] initWithTitle:@"麦克风权限" icon:@"" spot:HLMineCellSpotSettingPrivacyMicrophone];
    microphone.hasDetail = NO;
    microphone.hasSwitch = YES;
    
    HLMineCellModel *local = [[HLMineCellModel alloc] initWithTitle:@"位置权限" icon:@"" spot:HLMineCellSpotSettingPrivacyLocation];
    local.hasDetail = NO;
    local.hasSwitch = YES;
    
    return @[@[black], @[album, camera, microphone, local]];
}


+ (NSArray<NSArray<HLMineCellModel*> *> *)cellWithEditInfoWithModel:(HLUserInfoModel *)user
{
    HLMineCellModel *avatar = [[HLMineCellModel alloc] initWithTitle:@"更换头像" icon:@"" spot:HLMineCellSpotEditAvatar];

    HLMineCellModel *coverImage = [[HLMineCellModel alloc] initWithTitle:@"封面照片" icon:@"" spot:HLMineCellSpotEditCoverImage];
    
    HLMineCellModel *photoWall = [[HLMineCellModel alloc] initWithTitle:@"照片墙" icon:@"" spot:HLMineCellSpotEditPhotoWall];
    
    HLMineCellModel *nickname = [[HLMineCellModel alloc] initWithTitle:@"昵称" icon:@"" spot:HLMineCellSpotEditNickname];
    nickname.detail = user.nickName;
    
    HLMineCellModel *sex = [[HLMineCellModel alloc] initWithTitle:@"性别" icon:@"" spot:HLMineCellSpotEditSex];
    sex.detail = user.sexName;
    sex.hasDetail = NO;
    
    HLMineCellModel *birthday = [[HLMineCellModel alloc] initWithTitle:@"生日" icon:@"" spot:HLMineCellSpotEditBirthday];
    birthday.detail = user.birthday;
    
    HLMineCellModel *constellation = [[HLMineCellModel alloc] initWithTitle:@"星座" icon:@"" spot:HLMineCellSpotEditConstellation];
    constellation.detail = user.constellation;
    constellation.hasDetail = NO;
    
    HLMineCellModel *height = [[HLMineCellModel alloc] initWithTitle:@"身高" icon:@"" spot:HLMineCellSpotEditHeight];
    height.detail = user.heightString;
    
    HLMineCellModel *weight = [[HLMineCellModel alloc] initWithTitle:@"体重" icon:@"" spot:HLMineCellSpotEditWeight];
    weight.detail = user.weightString;
    
    HLMineCellModel *occupation = [[HLMineCellModel alloc] initWithTitle:@"职业" icon:@"" spot:HLMineCellSpotEditOccupation];
    occupation.detail = user.occupation;
    

    HLMineCellModel *signature = [[HLMineCellModel alloc] initWithTitle:@"个性签名" icon:@"" spot:HLMineCellSpotEditSignature];
    
    return @[@[avatar], @[nickname, signature], @[photoWall]];
}


@end
